import React, {Component} from 'react';
import {observable} from 'mobx';

class TodoListView extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <div>
                <ul>
                    {this.props.todoList.todo.map(todo => {
                        <TodoView todo={todo} key={todo.id}/>
                    })}
                </ul>
            </div>
        );
    }
}

const TodoView = observable(({todo}) => {
    <li>
        <input type="checkbox" checked={todo.finished} onClick={() => todo.finished = !todo.finished}/>{todo.title}
    </li>
})

export default TodoListView;